package com.ww.companyCabinetSystem.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.ww.companyCabinetSystem.dao.IProductsDao;
import com.ww.companyCabinetSystem.model.bo.MProductsBo;
import com.ww.companyCabinetSystem.utils.BeanUtils;
import com.ww.keyIdAutomaticGeneration.factory.KeyIdGenerationFactory;

@Component("products")
public class ProductsDaoImpl extends BaseDaoImpl implements  IProductsDao{

	@Override
	public boolean insertProducts(MProductsBo bo) {
		String keyId=KeyIdGenerationFactory.createKeyId();
		bo.setKeyId(keyId);
		BeanUtils.notNull(bo);
		return this.sqlSession.insert("com.ww.companyCabinetSystem.dao.IProductsDao.insertProducts",
				bo)>0;
	}

	@Override
	public boolean updateProducts(MProductsBo bo) {
		// TODO Auto-generated method stub
		return this.sqlSession.update("com.ww.companyCabinetSystem.dao.IProductsDao.updateProducts",
				bo)>0;
	}

	@Override
	public List<MProductsBo> selectByConfitions(MProductsBo bo) {
		// TODO Auto-generated method stub
		return this.sqlSession.selectList("com.ww.companyCabinetSystem.dao.IProductsDao.selectProducts",
				bo);
	}
	
}
